package com.itheima.service.impl;

import com.itheima.domain.Dish;
import com.itheima.domain.Taste;
import com.itheima.mapper.DishMapper;
import com.itheima.service.DishService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * date: 2022/5/19 14:27
 *
 * @author daya000
 */
@Service
public class DishServiceImpl implements DishService {
    @Autowired
    private DishMapper mapper;

    @Override
    public void addDish(Dish dish) {
        mapper.addDish(dish);
    }

    @Override
    public void addTaste(Taste taste) {
         mapper.addTaste(taste);
    }

    @Override
    public Dish selectByName(String name) {
        return mapper.selectByName(name);
    }

    @Override
    public List<Dish> selectByPage(String name,Integer page, Integer pageSize) {
        Integer index=(page-1)*pageSize;
        return mapper.selectByPage(name,index,pageSize);
    }

    @Override
    public Long selectTotal(String name) {
        return null;
    }

    @Override
    public Dish selectById(String id) {
        return mapper.selectById(id);
    }

    @Override
    public List<Taste> selectByDishId(String dishId) {
        return mapper.selectByDishId(dishId);
    }

    @Override
    public void updateDish(Dish dish) {
        mapper.updateDish(dish);
    }

    @Override
    public void deleteByDishId(String dishId) {
        mapper.deleteByDishId(dishId);
    }

    @Override
    public void deleteDishById(String id) {
        mapper.deleteDishById(id);
    }

    @Override
    public List<Dish> selectByCategoryId(String categoryId) {
        return mapper.selectByCategoryId(categoryId);
    }

    @Override
    public void updateStatus(Integer status,String id) {
        mapper.updateStatus(status,id);
    }
}
